package com.bloveoacom.weight;

import android.content.Context;
import android.support.v7.widget.AppCompatImageView;
import android.util.AttributeSet;
import android.view.View;

import com.bloveoacom.util.ActivityUtil;
import com.bloveoacom.util.StringUtils;
import com.bloveoacom.weichi.activity.UserInfo2Activity;
import com.bloveoacom.weichi.bean.OptionBean;


/**
 * author: yjl
 * e-mail: 1271901673@qq.com
 * time  : 2018/9/13
 * desc  :
 */
public class ClickImageView extends AppCompatImageView implements View.OnClickListener{

    private OptionBean optionBean;
    public void setData(OptionBean optionBean){
        this.optionBean = optionBean;
    }


    public ClickImageView(Context context) {
        this(context, null);
    }

    public ClickImageView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ClickImageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        setOnClickListener(this);
    }
    @Override
    public void onClick(View v) {
        if(optionBean!=null&& !StringUtils.isEmpty(optionBean.data)){
            ActivityUtil.startActivity(getContext(), UserInfo2Activity.class, optionBean.data);
        }
    }




}
